﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class MoveForward : MonoBehaviour
{
    public float speed = 20f;
    // Start is called before the first frame update
    void Start()
    {
        
    }

    // Update is called once per frame
    void Update()
    {
        // NPC 前移
        transform.Translate(Vector3.forward * speed * Time.deltaTime);

        // NPCT移动出屏幕消失
        if (transform.position.z > 30f || transform.position.z < -10f)
            Destroy(gameObject);
    
    }

    private void OnCollisionEnter(Collision collision)
    {
        Destroy(gameObject);
    }
}
